import 'package:animal/network/api.dart';
import 'package:animal/ui/message/NWApi.dart';
import 'package:animal/utils/index.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';

class MessageListController extends GetxController{
  final EasyRefreshController refreshController = EasyRefreshController();

  var entitys  = <MessageEntity>[];
  
  @override
  void onInit() {
    super.onInit();
    entitys = [
      MessageEntity(true, "It's good!"),
      MessageEntity(false, 'EasyRefresh'),
    ];
  }

  ///获取离线消息
  void getMessageList(){
    HttpManager().get(ChartApi.offlineMessageGet,queryParameters: {}).listen((value) {
      debugPrint(jsonDecode(value.data.toString()));
      if(value.data != null && value.data != null){

      }
    },onError: (err){
      debugPrint(err.message);
    });
  }
}

/// 信息实体
class MessageEntity {
  bool own;
  String msg;

  MessageEntity(this.own, this.msg);
}